home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-15 | 14.9 KB | 397 lines | [TEXT/MPS ] |
- /*------------------------------------------------------------------------------
- *
- * Apple Macintosh Developer Technical Support
- *
- * Installer 3.4 sample: installing a font resource into the appropriate place
- *
- * File: InstallFont.r - Rez Source
- *
- * by: Rich Kubota
- * modified: 12/1/92 rrk Include sample action atom to check for system 7.1 and
- * pre 7.1 system file.
- * 3/22/93 rrk Corrected the sample to install to the Times files
- * instead of the New York font file.
- *
- * Copyright © 1991 Apple Computer, Inc.
- * All rights reserved.
- *
- *------------------------------------------------------------------------------
- * This sample installs the "Times" font resource, supplied with System 7.0.1, into
- * the appropriate place: the Font Folder under System 7.1 or into the System file
- * for System 7.0.1 and earlier. This sample demonstrate the use of the 'inff'
- * Font Family Resource Atom.
- * It allows for custom installation of fonts.
- *
- * Note: For installation under System 7.1, the script needs to install the font into
- * the Font folder by using the new Folder Manager designator 'font'. This means that
- * the script needs to determine which system is present and act accordingly. The font
- * resource can still be installed directly into the 7.1 System file. Under 7.1, it is
- * preferable to install fonts to the Font folder. Fonts installed into the System file
- * have priority use in case of name conflicts.
- *
- * The reverse issue of installing fonts into the Fonts folder under 7.0.1 and earlier
- * IS a problem. In such case, fonts will not be recognized. Easy install rules
- * help to keep the user from installing the font in the wrong place. For custom
- * installation, this script includes a pre-installation action
- * atom to check the version of the System file, should the 7.1 font package be selected.
- * If the system is earlier, the code resource alerts the user that the target
- * volume has an incompatible system for installing fonts to the Font folder.
- * Unfortunately, Installer 3.4 installs fonts to the Font folder if the "special-font"
- * designator is used for System 7.0.1.
- *
- * IMPORTANT NOTE: There exists a known BUG with Installer v3.4 when installing
- * font resources. This problem is fixed with Installer 3.4.3.
- *
- * The problem occurs when a font resource already exists on a
- * System 7.0.1 or earlier system with the same ID as the one to be installed, BUT
- * with a different name. Under such situation, the Installer remaps the new FOND
- * ID as it should, however the remapping begins with ID 0. This normally results
- * in a remap to FOND ID 1 - a System reserved FOND ID. The result is that the
- * font will never be recognized. We have not found this problem to corrupt the
- * System. This problem will be corrected in a future release of the Installer.
- * The same problem exists in Installer 3.3. A similar problem exists with
- * Installer 3.2 except that no remapping takes place and there will exist FOND
- * resources with the same resource ID.
- *----------------------------------------------------------------------------*/
-
- #ifdef INSTRUCTIONS
-
-
- # To create the installation disk
- # 1. Name the floppy disk "Font Installer".
- # 2. Copy Installer 3.4 onto the floppy.
- # 3. Copy the Times font suitcase supplied in System 7.1 to the floppy.
- # 4. Rez and ScriptCheck 3.4b2 this script, and copy to the floppy.
-
- * Note that the CheckTgtSysVer code resource has already been compiled for you. You can
- * implement your own alterations to the code resource by following the make instructions
- * presented in the file CheckTgtSysVer.c
-
- # You can build and complete the script with the following lines:
- # Note: set up floppies with the appropriate names and contents before running scriptcheck
- # or set up folders with the same names and contents as the floppies
- # put these folders in the same folder as the script or at the root directory of same disk
-
- rez -o "Install Font Script" -t 'bbkr' -c 'bbkr' "InstallFont.r"
- setfile -a i "Install Font Script" #mark Inited
- scriptcheck -p "Install Font Script"
-
- #endif
-
-
- #include "Types.r" /* for the ICON and Action Atom code resources */
- #include "InstallerTypes.r"
- #include "CheckTgtSysVer.h"
-
-
- /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
- #define kDateNotChecked 0
- #define kTimesFontSize 287500 /* file is 287254 bytes + buffer */
- /* This figure is derived from the Times font supplied */
- /* with System 7.1. */
-
- /* Definitions for the rules */
- #define fontRule71 1000
- #define fontRulePre71 1001
- #define noSystem 1002
-
- /* Defines for the file spec atoms. These are specifications for source and destination files */
- #define fsSourceFont 2000
- #define fsTargetSystem 2001
- #define fsTargetFontFolder 2002
-
- /* This is the name of the source disk */
- #define FontDisk "Font Installer:"
-
- /* where we want to install our Font. */
- #define TargetPath71 "special-font:" /* Indicate that we want to install the font to
- the Font folder for System 7.1.
- */
- #define TargetPathPre71 "special-macs:" /* Indicate that we want to install the font to
- the System file for System 7.0.1 and ealier.
- */
-
- /* Definition for the packages. */
- #define pkTheFont71 3000
- #define pkTheFontPre71 3001
-
- /* Definition for the font resource atom. */
- #define ffTheFont71 4000
- #define ffTheFontPre71 4001
-
- /* Definition for the package comment resource */
- #define cmtTheFont71 5000
- #define cmtTheFontPre71 5001
- #define iconTheFont 6000
-
- /* Definitions for the action atom resources */
- #define aaCheckFor71 7000
- #define aaCheckForPre71 7001
-
- /* 'inaa' code resource definition */
- #define aaCodeID 10000
-
- /* December 1, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
- /* this value to a LongInt seconds value needed by the Installer. */
- #define currentReleaseDate 12011992
- #define currentVersion 102 /* Version 1.0.2 goes in the 'icmt' rsrc */
-
-
- /************************** Easy Install Rule resources **********************************/
- resource 'infr' (1) {
- format0 {{
- pickFirst, {fontRule71, fontRulePre71, noSystem} /* Select the Font rule */
- }};
- };
-
- resource 'inrl' (fontRule71) {
- format0 {{
- checkFileVersion{fsTargetSystem, 7, 0x10, release, 0},
- addUserDescription {"Click Install button to install\n"},
- /* message to appear in Easy Install screen */
- addUserDescription {"• the Times Font in the Font Folder\n"}, /* 2nd line of message */
- addPackages {{pkTheFont71}} /* installing the font package */
- }};
- };
-
- resource 'inrl' (fontRulePre71) {
- format0 {{
- checkFileVersion{fsTargetSystem, 0, 0x0, release, 0},
- addUserDescription {"Click Install button to install\n"},
- /* message to appear in Easy Install screen */
- addUserDescription {"• the Times Font into the System File\n"}, /* 2nd line of message */
- addPackages {{pkTheFontPre71}} /* installing the font package */
- }};
- };
-
- resource 'inrl' (noSystem) {
- format0 {{
- reportVolError {"There is no System on volume ^0."},
- }};
- };
-
- /***************************** Package Resources ************************************************/
- resource 'inpk' (pkTheFont71) { /* This package could include other atoms */
- format0 {
- showsOnCustom, /* Package appears in the Custom Install display */
- removable, /* Package can be removed */
- dontForceRestart, /* not necessary to reboot in this case */
- cmtTheFont71, /* package's 'icmt' resource id */
- kTimesFontSize, /* Package size must be entered manually */
- /* ScriptCheck wont do this for us. Note, make sure you
- use ScriptCheck v3.4b2 or greater.
- */
- "Install Times Font for Sys 7.1", { /* package name for package that shows on custom */
- 'inaa', aaCheckFor71,
- 'inff', ffTheFont71;
- }
- }
- };
-
- resource 'inpk' (pkTheFontPre71) { /* This package could include other atoms */
- format0 {
- showsOnCustom, /* Package appears in the Custom Install display */
- removable, /* Package can be removed */
- dontForceRestart, /* not necessary to reboot in this case */
- cmtTheFontPre71, /* package's 'icmt' resource id */
- kTimesFontSize, /* Package size must be entered manually */
- /* ScriptCheck wont do this for us. Note, make sure you
- use ScriptCheck v3.4b2 or greater.
- */
- "Install Times Font for Sys 7.0.1 and earlier", { /* package name for package that shows on custom */
- 'inaa', aaCheckForPre71,
- 'inff', ffTheFontPre71;
- }
- }
- };
-
- /***************************** Comments ************************************************/
- resource 'icmt' (cmtTheFont71) {
- currentReleaseDate,
- currentVersion,
- iconTheFont,
- "This package installs the Times Font into the System 7.1 Font Folder. "
- };
-
- resource 'icmt' (cmtTheFontPre71) {
- currentReleaseDate,
- currentVersion,
- iconTheFont,
- "This package installs the Times Font into the System File for System 7.0.1 and earlier."
- };
-
- resource 'ICON' (iconTheFont) {
- $"0430 4000 0A50 A000 0B91 1002 0822 0803"
- $"1224 0405 2028 0209 4010 0111 800C 00A1"
- $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
- $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
- $"0487 FE04 0288 0104 0188 0084 0088 0044"
- $"0088 0044 0088 00C4 0110 0188 0228 0310"
- $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
- $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
- };
-
-
-
- /********************************************* File Specs *******************************************/
- /* Source File Specs */
- resource 'infs' (fsSourceFont) {
- 'FFIL', /* File Type */
- 'DMOV', /* Creator */
- kDateNotChecked, /* ScriptCheck fills in the creation date */
- noSearchForFile, /* Do not search the source disk for the file */
- typeCrNeedNotMatch, /* file type and creator on source disk must match */
- FontDisk"Times" /* Path to the file */
- };
-
- resource 'infs' (fsTargetSystem) {
- 'ZSYS', /* File Type */
- 'MACS', /* Creator */
- 0, /* creation date not needed for target file specs */
- noSearchForFile, /* Do not search the target disk for the file */
- typeCrNeedNotMatch, /* match system 6 or 7 */
- TargetPathPre71"System" /* destination Path */
- };
-
- resource 'infs' (fsTargetFontFolder) {
- 'FFIL', /* File Type */
- 'DMOV', /* Creator */
- 0, /* creation date not needed for target file specs */
- noSearchForFile, /* Do not search the target disk for the file */
- typeCrNeedNotMatch, /* match system 6 or 7 */
- TargetPath71"Times" /* destination Path */
- };
-
- /*************************************** Font Family Atoms **********************************************/
- resource 'inff' (ffTheFont71) {
- format0 {
- deleteWhenRemoving, /* Delete the resource if remove (option-custom) is clicked */
- deleteWhenInstalling, /* delete the target before copying new one */
- copy, /* Copy rsrc to destination */
- noTgtRequired, /* Target file need not exist on dest to install */
- updateExisting, /* replace any preexisting file with the same name */
- copyIfNewOrUpdate, /* Copy whether or not target rsrc already exists */
- ignoreProtection, /* Do it even if the target rsrc is protected */
- srcNeedExist, /* Rsrc needs to exist on source disk */
- byName, /* use the name to find the source and target rsrc */
- nameMustMatch, /* this field is ignored if above is byName */
- fsTargetFontFolder, /* Target file spec to install rsrc into */
- fsSourceFont, /* Source file spec where to get rsrc */
- 0x20, /* 'FOND' is purgeable */
- kTimesFontSize, /* font resource size entered manually */
- 20, /* Resource ID of Times 'FOND' */
- entireFamily { /* all strikes found in FOND to be installed */
- },
- "Times Font", /* Atom description */
- "Times" /* Font Resource name */
- };
- };
-
- resource 'inff' (ffTheFontPre71) {
- format0 {
- deleteWhenRemoving, /* Delete the resource if remove (option-custom) is clicked */
- dontDeleteWhenInstalling, /* dont need to delete the target before copying new one */
- copy, /* Copy rsrc to destination */
- tgtRequired, /* System file need already exist on dest to install */
- updateExisting, /* replace any preexisting DA with the same name */
- copyIfNewOrUpdate, /* Copy whether or not target rsrc already exists */
- ignoreProtection, /* Do it even if the target rsrc is protected */
- srcNeedExist, /* Rsrc needs to exist on source disk */
- byName, /* use the name to find the source and target rsrc */
- nameMustMatch, /* this field is ignored if above is byName */
- fsTargetSystem, /* Target file spec to install rsrc into */
- fsSourceFont, /* Source file spec where to get rsrc */
- 0x20, /* 'FOND' is purgeable */
- kTimesFontSize, /* font resource size entered manually */
- 20, /* Resource ID of Times 'FOND' */
- entireFamily { /* all strikes found in FOND to be installed */
- },
- "Times Font", /* Atom description */
- "Times" /* Font Resource name */
- };
- };
-
- /******************************************** Action Atoms ************************************************/
-
- resource 'inaa' (aaCheckFor71) {
- format1 {
- suspendBusyCursors, /* go back to arrow cursor should alert happen */
- actBefore, /* act before the installation occurs */
- dontActOnRemove, /* dont need to be called on remove */
- actOnInstall, /* get called on installation */
- 'infn', /* code resource type */
- aaCodeID, /* code resource ID */
- kSys71, /* check for System 7.1 or greater */
- ""
- }
- };
-
- resource 'inaa' (aaCheckForPre71) {
- format1 {
- suspendBusyCursors, /* go back to arrow cursor should alert happen */
- actBefore, /* act before the installation occurs */
- dontActOnRemove, /* dont need to be called on remove */
- actOnInstall, /* get called on installation */
- 'infn', /* code resource type */
- aaCodeID, /* code resource ID */
- kSysPre71, /* check for System 7.1 or greater */
- ""
- }
- };
-
-
-
- /* The following resources are required by the CheckTgtSysVer action atom */
-
- resource 'STR#' (kErrStrings, purgeable) {
- {
- "There is no blessed system folder on the target volume. Aborting font installation.";
- "Cannot install this package to System 7.1 or greater. Aborting font installation.";
- "This package requires System 7.1 or greater. Aborting font installation.";
- "Unable to verify system version. Aborting installation.";
- }
- };
-
- /* this ALRT and DITL are used as an error screen */
-
- resource 'ALRT' (rUserAlert, purgeable) {
- {40, 20, 200, 375},
- rUserAlert,
- { /* array: 4 elements */
- /* [1] */
- OK, visible, silent,
- /* [2] */
- OK, visible, silent,
- /* [3] */
- OK, visible, silent,
- /* [4] */
- OK, visible, silent
- }
- };
-
-
- resource 'DITL' (rUserAlert, purgeable) {
- { /* array DITLarray: 3 elements */
- /* [1] */
- {130, 270, 150, 350},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {10, 60, 120, 350},
- StaticText {
- disabled,
- "Error. ^0."
- },
- /* [3] */
- {8, 8, 40, 40},
- Icon {
- disabled,
- 0
- }
- }
- };
-
- INCLUDE "CheckTgtSysVer.rsrc" 'infn' (10000) AS 'infn' (aaCodeID, $$Attributes);
-